package com.topisv.tms.repository.ulorder;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.topisv.tms.entity.ulorder.Ulorder;

/**
 * 线下订单_DAO
 * @author ch
 *
 */
public abstract interface UlorderDao extends PagingAndSortingRepository<Ulorder, Long>, JpaSpecificationExecutor<Ulorder>
{

	@Query("select t from Ulorder t where t.orderno=?")
	Ulorder loadByOrderno(String orderno);
	
	@Query("select t from Ulorder t where t.customerOrdeno=? and status='login'")
	Ulorder loadByCustomerOrdeno(String orderno);
	
	@Query("select t from Ulorder t where t.customerCode=? and t.customerOrdeno=? and status='login'")
	Ulorder getCustomerOrdeno(String customerCode, String customerOrdeno);
	
	@Query("select t from Ulorder t where t.customerCode=?1 and t.customerOrdeno=?2 and status <> 'cancel'")
	Ulorder getOwnerOrdeno(String customerCode, String customerOrdeno);
}